This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
pengs <- penguins[!is.na(penguins$sex),]
summary(pengs)
## species island bill_len bill_dep flipper_len
## Adelie :146 Biscoe :163 Min. :32.10 Min. :13.10 Min. :172
## Chinstrap: 68 Dream :123 1st Qu.:39.50 1st Qu.:15.60 1st Qu.:190
## Gentoo :119 Torgersen: 47 Median :44.50 Median :17.30 Median :197
## Mean :43.99 Mean :17.16 Mean :201
## 3rd Qu.:48.60 3rd Qu.:18.70 3rd Qu.:213
## Max. :59.60 Max. :21.50 Max. :231
## body_mass sex year
## Min. :2700 female:165 Min. :2007
## 1st Qu.:3550 male :168 1st Qu.:2007
## Median :4050 Median :2008
## Mean :4207 Mean :2008
## 3rd Qu.:4775 3rd Qu.:2009
## Max. :6300 Max. :2009
islands = c("Biscoe", "Dream", "Torgersen")
lats = c(-65.67431687652159, -64.73183354043242, -64.76629048892288)
lons = c(-65.94666214883208, -64.23378445084403, -64.08323121306947)
island_loc = data.frame(island=islands, lat=lats, lon=lons)
sex_options = unique(pengs$sex)
year_options = unique(pengs$year)
species_options = unique(pengs$species)
peng_summary <- pengs %>%
group_by(island, species, sex, year) %>%
summarize(population=n(),
body_mass=mean(body_mass),
flipper_len=mean(flipper_len))
## `summarise()` has grouped output by 'island', 'species', 'sex'. You can
## override using the `.groups` argument.
You can also embed plots, for example:
## `summarise()` has grouped output by 'species', 'sex'. You can override using
## the `.groups` argument.
## `summarise()` has grouped output by 'species', 'sex'. You can override using
## the `.groups` argument.
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode